package com.it;

import com.it.utils.UtilJWT;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.ArrayList;
import java.util.List;

@SpringBootApplication
@Slf4j
public class Application {

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
		ArrayList<String> list = new ArrayList<>();
		list.add("student:add");
		list.add("student:query");
		String token = UtilJWT.createToken(101, "Coke", list);
		log.info("创建了一个token: {}", token);

		Boolean aBoolean = UtilJWT.verifyToken(token);
		log.info("验证token：{}", aBoolean);

		Integer iUserId = UtilJWT.getIUserId(token);
		log.info("获取到token中的用户编号: {}", iUserId);

		String username = UtilJWT.getUsername(token);
		log.info("获取到token中的用户名称: {}", username);

		List<String> auth = UtilJWT.getAuth(token);
		log.info("获取到token中的用户权限: {}", auth);
	}

}
